package com.nbstar.film.spider.font.woff;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: wangxindong
 * @date: 2018/8/30-20:39
 */
public class TableDirectoryEntry {

    private AbstractOTFDataStream data;

    public TableDirectoryEntry() {

    }

    public TableDirectoryEntry(AbstractOTFDataStream data) {
        this.data = data;
    }

    public void read(WoffFont woffFont) throws IOException {
        WoffHeader header = woffFont.getHeader();
        if (null == header) {
            throw new RuntimeException("header null");
        }
        int numberTables = header.getNumTables();
        for (int i = 0; i < numberTables; i++) {
            int tag = data.readInt();
            int offset = data.readInt();
            int compLength = data.readInt();
            int origChecksum = data.readInt();
            int origLength = data.readInt();
            TableDirectory e = new
                    TableDirectory(Integer.toHexString(tag), offset, compLength, origLength, origChecksum);
            //woffFont.addTable(e);
        }
    }
}
